--点击事件屏蔽层
local MaskLayer = class("MaskLayer", function(bHaveBg)
	local alpha = bHaveBg and 0 or 200
    return cc.LayerColor:create(cc.c4b(td.WIN_COLOR.r, td.WIN_COLOR.g, td.WIN_COLOR.b, alpha))
end)

function MaskLayer:ctor()
--    self.m_yOffset = 800
--    self.m_xOffset = 800
--    --self:setContentSize(display.width , display.height + self.m_yOffset )    
--    self:changeWidthAndHeight(display.width + self.m_xOffset * 2 , display.height + self.m_yOffset * 2) --高度加800(因为是横屏，所以加在width上)，软键盘弹出时上移才不会见底
    self:BlockTouch()

--    if bHaveBg then
        self.bg = display.newSprite("UI/bg/layer_bg.jpg")
		self.bg:setOpacity(255)
--		self.bgScale = display.width/self.bg:getContentSize().width
--        self.bg:scale(self.bgScale*1.5):addTo(self)
--        self.bg:move(display.width/2 + self.m_xOffset,display.height/2 + self.m_yOffset)
--    end
end

function MaskLayer:BlockTouch()
    local eventDsp = self:getEventDispatcher()
    local listener = cc.EventListenerTouchOneByOne:create()
    listener:registerScriptHandler( function(touch, event)
        print("MaskLayer Worked! ")
        return true
    end , cc.Handler.EVENT_TOUCH_BEGAN)
    listener:setSwallowTouches(true)
    eventDsp:addEventListenerWithSceneGraphPriority(listener, self)
end


return MaskLayer